<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- <link rel="icon" href="../../favicon.ico"> -->

    <title>发布职位</title>

    <!-- Bootstrap core CSS -->
    <link href="./libs/bootstarp/css/bootstrap.min.css" rel="stylesheet">

    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <!-- <link href="../../assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet"> -->

    <!-- Custom styles for this template -->
    <link href="./css/index.css" rel="stylesheet">
    <link rel="stylesheet" href="./css/user.css">

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <!-- <script src="../../assets/js/ie-emulation-modes-warning.js"></script> -->

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        [v-cloak] {
            display: none !important;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak>
        <zdy-nav title="就业信息平台" :nav-list="navList"></zdy-nav>

        <div class="container zdy-container">
            <form class="form-horizontal user-form">
                <div class="row col-md-offset-2">
                    <div class="form-group col-md-8">
                        <label for="inputText1" class="col-sm-3 control-label">职位名称</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="inputText1" placeholder="请输入职位名称"
                                v-model="jobInfo.title">
                        </div>
                    </div>
                    <div class="form-group col-md-8">
                        <label for="inputText2" class="col-sm-3 control-label">学历</label>
                        <div class="col-sm-9">
                            <!-- <input type="text" class="form-control" id="inputText2" placeholder="请输入学历要求"> -->
                            <select v-model="jobInfo.degree" class="form-control">
                                <option value="不限">不限</option>
                                <option value="大专">大专</option>
                                <option value="本科">本科</option>
                                <option value="研究生">研究生</option>
                                <option value="博士">博士</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group col-md-8">
                        <label for="inputText3" class="col-sm-3 control-label">工作地点</label>
                        <div class="col-sm-9">
                            <input type="tel" class="form-control" id="inputText3" placeholder="请输入工作地点"
                                v-model="jobInfo.address">
                        </div>
                    </div>
                    <div class="form-group col-md-8">
                        <label for="inputText4" class="col-sm-3 control-label">职位优势</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="inputText4" placeholder="请输入优势（例如：五险一金）"
                                v-model="jobInfo.benefits">
                        </div>
                    </div>
                    <div class="form-group col-md-8">
                        <label for="inputText6" class="col-sm-3 control-label">职位描述</label>
                        <div class="col-sm-9">
                            <textarea class="form-control" rows="3" placeholder="请输入职位描述"
                                v-model="jobInfo.jobInfo"></textarea>
                        </div>
                    </div>
                    <div class="form-group col-md-8">
                        <label for="inputText5" class="col-sm-3 control-label">备注信息</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="inputText5" placeholder="请输入备注信息"
                                v-model="jobInfo.comment">
                        </div>
                    </div>
                    <div class="form-group col-md-12 ">
                        <div class="col-sm-offset-2 col-sm-10">
                            <button type="button" class="btn btn-primary" @click="handleOnSubmit">确定</button>
                            <button type="button" class="btn btn-default" @click="handleOnClose">取消</button>
                        </div>
                    </div>
                </div>
            </form>
        </div><!-- /.container -->

        <zdy-footer></zdy-footer>
    </div>

    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> -->
    <!-- <script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script> -->
    <script src="./libs/jquery/jquery.min.js"></script>
    <script src="./libs/bootstarp/js/bootstrap.js"></script>
    <script src="./libs/vue/vue.js"></script>
    <script src="./tpl/publicTpl.js"></script>
    <script src="./js/utils.js"></script>
    <script src="./js/xhr.js"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <!-- <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script> -->
    <script>
        var vm = new Vue({
            el: '#app',
            data() {
                return {
                    navList: [{ text: '首页', path: './enterprise.html' }],
                    jobInfo: { comment: '' }
                }
            },
            created() {
                var comp = auth();
                var job = getSession('jobInfo')
                this.jobInfo = Object.assign(this.jobInfo, job)
                this.jobInfo['jobId'] = job.id;
            },
            methods: {
                handleOnSubmit() {
                    if (this.jobInfo.title == '') {
                        alert('请输入职位名称')
                    } else if (this.jobInfo.degree == '') {
                        alert("请选择学历要求")
                    } else if (this.jobInfo.address == '') {
                        alert('请输入工作地点')
                    } else if (this.jobInfo.benefits == '') {
                        alert('请输入职位优势')
                    } else if (this.jobInfo.jobInfo == '') {
                        alert('请输入职位描述')
                    } else {
                        xhr.send('/pub/iface/job/editJob', this.jobInfo, function (res) {
                            alert('编辑成功')
                            window.history.back();
                        })
                    }
                },
                handleOnClose() {
                    window.history.back();
                }
            },
        })
    </script>
</body>

</html>